<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<meta name="copyright" content="http://www.appcms.org" />
<link rel="stylesheet" href="skin/base.css">
<link rel="stylesheet" href="skin/today.css">
<script src="js/zy_control.js"></script>
<script src="js/zy_click.js"></script>
<script src="js/zy_slide.js"></script>
<script src="js/config.js"></script>
</head>
<body>
<div id="main"></div>
</body>
<script>
	zy_init();
	var page=1;
	function jump(id,catid){
		localStorage['news_id']=id;
		localStorage['news_catid']=catid;
		uexWindow.open('news_show','0','news_show.html','2','', '',0);
	}
	
	function getMain(t){
		if (t==-1){
			$$('main').className="loading";
		}
		if(t<1){
			page=1;
		}
		var url = app_path+'index.php?m=iappToday&c=app&a=init&page='+page;
		uexXmlHttpMgr.open(t,'post',url,"8000");
		uexXmlHttpMgr.send(t);
	}
	
	window.uexOnload=function(type){
		if (!type){
			uexWindow.setBounce("1");
			uexWindow.setBounceParams("0",'{"imagePath":"res://loading.png","textColor":"#666","levelText":"","pullToReloadText":"拖动刷新","releaseToReloadText":"释放刷新","loadingText":"加载中，请稍等"}');
			uexWindow.setBounceParams("1",'{"imagePath":"res://loading.png","textColor":"#666","levelText":"","pullToReloadText":"上拉加载更多","releaseToReloadText":"释放加载","loadingText":"加载中，请稍等"}');
			uexWindow.showBounceView("0","#f3f3f3","1");
			uexWindow.notifyBounceEvent("0","1");
		    uexWindow.showBounceView("1","#f3f3f3","1");
　　　　	    uexWindow.notifyBounceEvent("1","1");
			uexWindow.onBounceStateChange=function(t,s){
　　　　　　		if(t=="0"||t=="1"){
　　　　　　　　		if(s=="2"){
						getMain(t);
					}
　　　　　　		}
			}
			
			uexXmlHttpMgr.onData = function(opId, status, data){
				uexXmlHttpMgr.close(opId);
				uexWindow.resetBounceView(opId);
				if(status==1){
					data = JSON.parse(data);			
					if(opId<1){				
						$$('main').innerHTML='';
						uexWindow.setBounceParams("0",'{"imagePath":"res://loading.png","textColor":"#666","levelText":"上次更新：'+Now()+'","pullToReloadText":"拖动刷新","releaseToReloadText":"释放刷新","loadingText":"加载中，请稍等"}');
					}
					var data=data['data'];
					if(data.length>0){
						page++;
						$$("main").className = '';
						
						var div = document.createElement("div");
						div.className='today';
						
						var html ='';
						for (i in data) {
							html +='<div class="time">'+data[i]['addtime']+'</div>';
							
							html +='<div class="item">';
							var top = data[i]['datas']['top'];
                            html +='    <div class="top" onclick="jump('+top['id']+','+top['catid']+')"><div class="loadimg"><img src="'+top['thumb']+'" class="hide" onload="this.className=\'\'" /></div>'+
									'      <h3>'+top['title']+'</h3>'+
									'   </div>';
							html +='<ul>';
							var list = data[i]['datas']['list'];
							for(k in list){
								html +='<li ontouchstart="zy_touch(\'down\')" onclick="jump('+list[k]['id']+','+list[k]['catid']+')"><h3>'+list[k]['title']+'</h3>'+
									   '<div class="loadimg"><img src="'+list[k]['thumb']+'" class="hide" onload="this.className=\'\'" /></div>'+
									   '</li>';
							}	
							html +='</ul>';
							html +='</div>';
						}
						div.innerHTML = html;
						$$('main').appendChild(div);			
					}else{
						if(opId==-1||opId==0){
							$$("main").className = 'notdata';
						}
					}
				}else if(status ==-1) {//加载失败
					if(opId==-1){
						$$("main").className='errer';
					}else{
						uexWindow.toast("0","5",'加载失败',1000);
					}
				}
			}
			
			getMain(-1);
		}
	}
	</script>
</html>